﻿using System;
using Newtonsoft.Json.Linq;

namespace SourcesUnPacker
{
    /// <summary>
    /// 技能数据
    /// </summary>
    public class SkillData
    {   
        /// <summary>
        /// 技能id
        /// </summary>
        public readonly int? _Id; // 0x10
        
        /// <summary>
        /// 技能名称
        /// </summary>
        public readonly string _Name; // 0x18
        public readonly int? _Char; // 0x20
        public readonly int? _SkillIndex; // 0x28
        public readonly int? _Bullet; // 0x30
        public readonly int? _Animation; // 0x38
        public readonly int? _Spr; // 0x40
        public readonly int? _Honor; // 0x48
        public readonly int? _Level; // 0x50
        public readonly int? _Weapon; // 0x58
        public readonly int? _Mp; // 0x60
        public readonly int? _Hp; // 0x68
        public readonly int? _Range; // 0x70
        public readonly int? _MinRange; // 0x78
        public readonly int? _Area; // 0x80
        public readonly int? _Target; // 0x88
        public readonly int? _TargetArea; // 0x90
        public readonly int? _TargetType; // 0x98
        public readonly int? _Effect; // 0xA0
        public readonly int? _EffectTime; // 0xA8
        public readonly int? _Amplifier; // 0xB0
        public readonly string _Desc; // 0xB8
        public readonly string _BuffId; // 0xC0
        public readonly int? _BuffCount; // 0xC8
        public readonly int? _BuffHolder; // 0xD0
        public readonly int? _SndOnCast; // 0xD8
        public readonly int? _SndOnHit; // 0xE0
        public readonly bool? _Enable; // 0xE8
        public readonly int? _Splash; // 0xEC
        
        public SkillData(JArray dataArray)
        {
            _Id = dataArray[0].Type != JTokenType.Null ? Convert.ToInt32(dataArray[0]) : (int?)null;
            _Name = dataArray[1].Type != JTokenType.Null ? Convert.ToString(dataArray[1]) : null;
            _Char = dataArray[2].Type != JTokenType.Null ? Convert.ToInt32(dataArray[2]) : (int?)null;
            _SkillIndex = dataArray[3].Type != JTokenType.Null ? Convert.ToInt32(dataArray[3]) : (int?)null;
            _Bullet = dataArray[4].Type != JTokenType.Null ? Convert.ToInt32(dataArray[4]) : (int?)null;
            _Animation = dataArray[5].Type != JTokenType.Null ? Convert.ToInt32(dataArray[5]) : (int?)null;
            _Spr = dataArray[6].Type != JTokenType.Null ? Convert.ToInt32(dataArray[6]) : (int?)null;
            _Honor = dataArray[7].Type != JTokenType.Null ? Convert.ToInt32(dataArray[7]) : (int?)null;
            _Level = dataArray[8].Type != JTokenType.Null ? Convert.ToInt32(dataArray[8]) : (int?)null;
            _Weapon = dataArray[9].Type != JTokenType.Null ? Convert.ToInt32(dataArray[9]) : (int?)null;
            _Mp = dataArray[10].Type != JTokenType.Null ? Convert.ToInt32(dataArray[10]) : (int?)null;
            _Hp = dataArray[11].Type != JTokenType.Null ? Convert.ToInt32(dataArray[11]) : (int?)null;
            _Range = dataArray[12].Type != JTokenType.Null ? Convert.ToInt32(dataArray[12]) : (int?)null;
            _MinRange = dataArray[13].Type != JTokenType.Null ? Convert.ToInt32(dataArray[13]) : (int?)null;
            _Area = dataArray[14].Type != JTokenType.Null ? Convert.ToInt32(dataArray[14]) : (int?)null;
            _Target = dataArray[15].Type != JTokenType.Null ? Convert.ToInt32(dataArray[15]) : (int?)null;
            _TargetArea = dataArray[16].Type != JTokenType.Null ? Convert.ToInt32(dataArray[16]) : (int?)null;
            _TargetType = dataArray[17].Type != JTokenType.Null ? Convert.ToInt32(dataArray[17]) : (int?)null;
            _Effect = dataArray[18].Type != JTokenType.Null ? Convert.ToInt32(dataArray[18]) : (int?)null;
            _EffectTime = dataArray[19].Type != JTokenType.Null ? Convert.ToInt32(dataArray[19]) : (int?)null;
            _Amplifier = dataArray[20].Type != JTokenType.Null ? Convert.ToInt32(dataArray[20]) : (int?)null;
            _Desc = dataArray[21].Type != JTokenType.Null ? Convert.ToString(dataArray[21]) : null;
            _BuffId = dataArray[22].Type != JTokenType.Null ? Convert.ToString(dataArray[22]) : null;
            _BuffCount = dataArray[23].Type != JTokenType.Null ? Convert.ToInt32(dataArray[23]) : (int?)null;
            _BuffHolder = dataArray[24].Type != JTokenType.Null ? Convert.ToInt32(dataArray[24]) : (int?)null;
            _SndOnCast = dataArray[25].Type != JTokenType.Null ? Convert.ToInt32(dataArray[25]) : (int?)null;
            _SndOnHit = dataArray[26].Type != JTokenType.Null ? Convert.ToInt32(dataArray[26]) : (int?)0;
            _Enable = dataArray[27].Type != JTokenType.Null ? Convert.ToBoolean(dataArray[27]) : (bool?)null;
            _Splash = dataArray[28].Type != JTokenType.Null ? Convert.ToInt32(dataArray[28]) : (int?)null;
            
        }
        
    }
}